package com.example.cheng.controller;

import com.common.cheng.entity.Result;
import com.common.cheng.util.CheckStr;
import com.example.cheng.pojo.User;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiOperation;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.TimeUnit;

@RestController
@Api(tags = "测试1")
@RequestMapping("/hello")
public class HelloController {

    @ApiOperation(value = "你好")
    @GetMapping("/hello")
//    @ApiImplicitParams({
//            @ApiImplicitParam(paramType = "query", name = "id", value = "账号", required = true, dataType = "String"),
//            @ApiImplicitParam(paramType = "query", name = "name", value = "姓名", required = true, dataType = "String"),
//            @ApiImplicitParam(paramType = "query", name = "age", value = "年龄", required = false, dataType = "Integer"),
//    })
    @ApiImplicitParam(paramType = "query", name = "str", value = "字符串", required = true, dataType = "String")
    public Result<Integer> hello(String str) {
//        System.out.println("熔断模拟被访问");
//        TimeUnit.SECONDS.sleep(6);
        int len = CheckStr.checkLen(str);
        return Result.success(len);
    }
}